from typedef cimport *
from events cimport *
from factory cimport *
from render cimport *

DEF TR_MAX_NAME_LEN = 64

cdef extern from 'stdafx.h':
    HWND SetActiveWindow(HWND hWnd)

    ISouiFactory* _CreateSouiFactory 'CreateSouiFactory'()

    INT_PTR _SMessageBox 'SMessageBox'(HWND hWnd, LPCTSTR lpText, LPCTSTR lpCaption, UINT uType)

    ctypedef struct IObjRefVtbl:
        long AddRef(IObjRef* this)
        long Release(IObjRef* this)
        void OnFinalRelease(IObjRef* this)

    ctypedef struct IObjRef:
        IObjRefVtbl* lpVtbl

    ctypedef struct IObjectVtbl:
        BOOL IsClass(IObject* this, LPCWSTR lpszName)
        LPCWSTR GetObjectClass(IObject* this)
        int GetObjectType(IObject* this)
        int GetID(IObject* this)
        void SetID(IObject* this, int nID)
        LPCWSTR GetName(IObject* this)
        void SetName(IObject* this, LPCWSTR pszName)
        BOOL InitFromXml(IObject* this, IXmlNode* xmlNode)
        void OnInitFinished(IObject* this, IXmlNode* xmlNode)
        HRESULT ISetAttribute(IObject* this, const IStringW*strAttribName, const IStringW*strValue, BOOL bLoading)
        HRESULT SetAttributeA(IObject* this, LPCSTR pszAttr, LPCSTR pszValue, BOOL bLoading)
        HRESULT SetAttribute(IObject* this, LPCWSTR pszAttr, LPCWSTR pszValue, BOOL bLoading)
        BOOL GetAttribute(const IObject* this, LPCWSTR strAttr, IStringW*pValue)
        HRESULT AfterAttribute(IObject* this, LPCWSTR pszAttr, LPCWSTR pszValue, BOOL bLoading, HRESULT hr)
        # void SetAttrHandler(IObject* this, FunAttrHandler attrHandler)

    ctypedef struct IObject: # (IObjRef)
        IObjectVtbl* lpVtbl

    ctypedef struct ITranslatorMgrVtbl:
        void SetLanguage(ITranslatorMgr* this, LPCWSTR pszLang)
        void GetLanguage(ITranslatorMgr* this, wchar_t szOut[TR_MAX_NAME_LEN])
        BOOL CreateTranslator(ITranslatorMgr* this, ITranslator**ppTranslator)
        BOOL InstallTranslator(ITranslatorMgr* this, ITranslator* ppTranslator)
        BOOL UninstallTranslator(ITranslatorMgr* this, REFGUID id)
        int tr(ITranslatorMgr* this, const IStringW*strSrc, const IStringW*strCtx, wchar_t*pszOut, int nLen)

    ctypedef struct ITranslatorMgr:
        ITranslatorMgrVtbl* lpVtbl

    ctypedef struct ITranslatorVtbl:
        BOOL Load(ITranslator* this, LPVOID pData, UINT uType)
        void GetName(ITranslator* this, wchar_t szBuf[TR_MAX_NAME_LEN])
        BOOL NameEqual(ITranslator* this, LPCWSTR pszName)
        GUID guid(ITranslator* this)
        int tr(ITranslator* this, const IStringW*strSrc, const IStringW*strCtx, wchar_t*pszOut, int nLen)
        void getFontInfo(ITranslator* this, IStringW* strFont)

    ctypedef struct ITranslator:
        ITranslatorVtbl* lpVtbl

    ctypedef struct IToolTipFactoryVtbl:
        IToolTip* CreateToolTip(IToolTipFactory* this, HWND hHost)
        void DestroyToolTip(IToolTipFactory* this, IToolTip* pToolTip)

    ctypedef struct IToolTipFactory:
        IToolTipFactoryVtbl* lpVtbl

    ctypedef struct IMsgFilterVtbl:
        BOOL PreTranslateMessage(IMsgFilter* this, MSG* pMsg)

    ctypedef struct IMsgFilter:
        IMsgFilterVtbl* lpVtbl

    ctypedef struct IToolTipVtbl:
        void UpdateTip(IToolTip* this, const TIPID*id, RECT rc, LPCTSTR pszTip, int nScale)
        void ClearTip(IToolTip* this)
        void RelayEvent(IToolTip* this, const MSG*pMsg)
        
    ctypedef struct IToolTip:
        IToolTipVtbl* lpVtbl

    ctypedef struct IMsgLoopFactoryVtbl:
        HRESULT CreateMsgLoop(IMsgLoopFactory* this, IMessageLoop**ppMsgLoop, IMessageLoop *pParentLoop)

    ctypedef struct IMsgLoopFactory: # (IObjRef)
        IMsgLoopFactoryVtbl* lpVtbl

    ctypedef struct IMessageLoopVtbl:
        BOOL AddMessageFilter(IMessageLoop* this, IMsgFilter* pMessageFilter)
        BOOL RemoveMessageFilter(IMessageLoop* this, IMsgFilter* pMessageFilter)
        BOOL AddIdleHandler(IMessageLoop* this, IIdleHandler* pIdleHandler)
        BOOL RemoveIdleHandler(IMessageLoop* this, IIdleHandler* pIdleHandler)
        BOOL PreTranslateMessage(IMessageLoop* this, MSG* pMsg)
        BOOL OnIdle(IMessageLoop* this, int nIdleCount)
        int Run(IMessageLoop* this)
        BOOL IsRunning(IMessageLoop* this)
        void OnMsg(IMessageLoop* this, LPMSG pMsg)
        void Quit(IMessageLoop* this, int nCode)
        BOOL PostTask(IMessageLoop* this, IRunnable* runable)
        int RemoveTasksForObject(IMessageLoop* this, void*pObj)

    ctypedef struct IMessageLoop: # (IObjRef)
        IMessageLoopVtbl* lpVtbl

    ctypedef struct IIdleHandlerVtbl:
        BOOL OnIdle(IIdleHandler* this)

    ctypedef struct IIdleHandler:
        IIdleHandlerVtbl* lpVtbl

    ctypedef struct IRunnableVtbl:
        IRunnable* clone(IRunnable* this)
        void run(IRunnable* this)
        void* getObject(IRunnable* this)
        const char* getClassInfo(IRunnable* this)

    ctypedef struct IRunnable: # (IObjRef)
        IRunnableVtbl* lpVtbl


    ctypedef struct ILogMgrVtbl:
        BOOL config(ILogMgr* this, const char *configPath)
        BOOL configFromString(ILogMgr* this, const char *configContent)
        BOOL start(ILogMgr* this)
        BOOL stop(ILogMgr* this)
        BOOL prePushLog(ILogMgr* this, int level)
        BOOL pushLog(ILogMgr* this, int level, const char *filter, const char *log, const char *file, int line, const char *func, const void *pRetAddr)
        BOOL isLoggerEnable(ILogMgr* this)
        BOOL enableLogger(ILogMgr* this, BOOL enable)
        BOOL setLoggerName(ILogMgr* this, const char *name_u8)
        BOOL setLoggerPath(ILogMgr* this, const char *path_u8)
        BOOL setLoggerLevel(ILogMgr* this, int nLevel)
        BOOL setLoggerFileLine(ILogMgr* this, BOOL enable)
        BOOL setLoggerDisplay(ILogMgr* this, BOOL enable)
        BOOL setLoggerOutFile(ILogMgr* this, BOOL enable)
        BOOL setLoggerLimitsize(ILogMgr* this, unsigned int limitsize)
        void setOutputFileBuilder(ILogMgr* this, IOutputFileBuilder * pOutputFileBuilder)

    ctypedef struct ILogMgr: # (IObjRef)
        ILogMgrVtbl* lpVtbl

    ctypedef struct IOutputFileBuilderVtbl:
        BOOL monthDir(IOutputFileBuilder* this)
        BOOL dayLog(IOutputFileBuilder* this)
        BOOL buildOutputFile(IOutputFileBuilder* this, char*pszFileName, int nLen, tm time, const char*pszLogName, unsigned long pid, int curFileIndex)

    ctypedef struct IOutputFileBuilder:
        IOutputFileBuilderVtbl* lpVtbl

    ctypedef struct IOutputListenerVtbl:
        void onOutputLog(IOutputListener* this, int level, const char*filter, const char*log, int nLogLen, DWORD_PTR time_)

    ctypedef struct IOutputListener:
        IOutputListenerVtbl* lpVtbl

    ctypedef struct IAttrStorageFactoryVtbl:
        HRESULT CreateAttrStorage(IAttrStorageFactory* this, IWindow* owner, IAttrStorage**ppAttrStorage)

    ctypedef struct IAttrStorageFactory: # (IObjRef)
        IAttrStorageFactoryVtbl* lpVtbl

    ctypedef struct IAttrStorageVtbl:
        void OnSetAttribute(IAttrStorage* this, const IStringW*strName, const IStringW*strValue, BOOL bHandled)
        BOOL OnGetAttribute(IAttrStorage* this, const IStringW*strName, IStringW*strValue)

    ctypedef struct IAttrStorage: # (IObjRef)
        IAttrStorageVtbl* lpVtbl

    ctypedef struct ITaskLoopVtbl:
        BOOL getName(ITaskLoop* this, char*pszBuf, int nBufLen)
        void start(ITaskLoop* this, const char*pszName, Priority priority)
        void stop(ITaskLoop* this)
        long postTask(ITaskLoop* this, const IRunnable*runnable, BOOL waitUntilDone, int priority)
        void cancelTasksForObject(ITaskLoop* this, void*object)
        BOOL cancelTask(ITaskLoop* this, long taskId)
        int getTaskCount(ITaskLoop* this)
        BOOL isRunning(ITaskLoop* this)
        BOOL getRunningTaskInfo(ITaskLoop* this, char*buf, int bufLen)

    ctypedef struct ITaskLoop: # (IObjRef)
        ITaskLoopVtbl* lpVtbl

    ctypedef struct IRealWndHandlerVtbl:
        HWND OnRealWndCreate(IRealWndHandler* this, IWindow* pRealWnd)
        void OnRealWndDestroy(IRealWndHandler* this, IWindow* pRealWnd)
        BOOL OnRealWndInit(IRealWndHandler* this, IWindow* pRealWnd)
        BOOL OnRealWndSize(IRealWndHandler* this, IWindow* pRealWnd)
        BOOL OnRealWndPosition(IRealWndHandler* this, IWindow* pRealWnd, RECT rcWnd)

    ctypedef struct IRealWndHandler: # (IObjRef)
        IRealWndHandlerVtbl* lpVtbl

    ctypedef struct IScriptFactoryVtbl:
        HRESULT CreateScriptModule(IScriptFactory* this, IScriptModule**ppScriptModule)

    ctypedef struct IScriptFactory: # (IObjRef)
        IScriptFactoryVtbl* lpVtbl

    ctypedef struct IScriptModuleVtbl:
        void* GetScriptEngine(IScriptModule* this)
        void executeScriptFile(IScriptModule* this, LPCSTR pszScriptFile)
        void executeScriptBuffer(IScriptModule* this, LPCSTR buff, size_t sz)
        BOOL executeScriptedEventHandler(IScriptModule* this, LPCSTR handler_name, IEvtArgs* pEvt)
        int executeMain(IScriptModule* this, HINSTANCE hInst, LPCSTR pszWorkDir, LPCSTR pszArgs)
        LPCSTR getIdentifierString(const IScriptModule* this)

    ctypedef struct IScriptModule: # (IObjRef)
        IScriptModuleVtbl* lpVtbl

    ctypedef struct IAnimationVtbl:
        IAnimation* clone(IAnimation* this)
        void copy(IAnimation* this, const IAnimation*src)
        void reset(IAnimation* this)
        void cancel(IAnimation* this)
        void setInterpolator(IAnimation* this, IInterpolator* i)
        void setDuration(IAnimation* this, long durationMillis)
        void scaleCurrentDuration(IAnimation* this, float scale)
        void setFillBefore(IAnimation* this, BOOL bFill)
        void setFillAfter(IAnimation* this, BOOL bFill)
        BOOL getFillBefore(IAnimation* this)
        BOOL getFillAfter(IAnimation* this)
        void setStartOffset(IAnimation* this, long offset)
        BOOL isFillEnabled(IAnimation* this)
        void setFillEnabled(IAnimation* this, BOOL fillEnabled)
        void setStartTime(IAnimation* this, int64_t startTimeMillis)
        void start(IAnimation* this)
        void startNow(IAnimation* this)
        void setRepeatMode(IAnimation* this, RepeatMode repeatMode)
        void setRepeatCount(IAnimation* this, int repeatCount)
        void setZAdjustment(IAnimation* this, ZAdjustment zAdjustment)
        IInterpolator* getInterpolator(IAnimation* this)
        int64_t getStartTime(IAnimation* this)
        long getDuration(IAnimation* this)
        long getStartOffset(IAnimation* this)
        RepeatMode getRepeatMode(IAnimation* this)
        int getRepeatCount(IAnimation* this)
        ZAdjustment getZAdjustment(IAnimation* this)
        void setAnimationListener(IAnimation* this, IAnimationListener* listener)
        long computeDurationHint(IAnimation* this)
        BOOL getTransformation2(IAnimation* this, uint64_t currentTime, ITransformation* outTransformation, float scale)
        BOOL getTransformation(IAnimation* this, int64_t currentTime, ITransformation* outTransformation)
        BOOL hasStarted(IAnimation* this)
        BOOL hasEnded(IAnimation* this)
        void applyTransformation(IAnimation* this, float interpolatedTime, ITransformation*t)
        BOOL hasAlpha(IAnimation* this)
        void initialize(IAnimation* this, int width, int height, int parentWidth, int parentHeight, int nScale)
        void setUserData(IAnimation* this, ULONG_PTR data)
        ULONG_PTR getUserData(IAnimation* this)

    ctypedef struct IAnimation: # (IObject)
        IAnimationVtbl* lpVtbl

    ctypedef struct IAnimationListenerVtbl:
        void OnAnimationStart(IAnimationListener* this, IAnimation* animation)
        void OnAnimationStop(IAnimationListener* this, IAnimation* animation)
        void OnAnimationRepeat(IAnimationListener* this, IAnimation* animation)

    ctypedef struct IAnimationListener:
        IAnimationListenerVtbl* lpVtbl

    ctypedef struct ITransformationVtbl:
        IMatrix* GetMatrix(ITransformation* this)
        BYTE GetAlpha(ITransformation* this)
        void SetAlpha(ITransformation* this, BYTE alpha)
        void Clear(ITransformation* this)
        void SetTransformationType(ITransformation* this, int type)
        void Compose(const ITransformation*t)

    ctypedef struct ITransformation:
        ITransformationVtbl* lpVtbl

    ctypedef struct IInterpolatorVtbl:
        float getInterpolation(IInterpolator* this, float input)

    ctypedef struct IInterpolator: # (IObject)
        IInterpolatorVtbl* lpVtbl

    ctypedef struct IValueAnimatorVtbl:
        void setDuration(IValueAnimator* this, long duration)
        long getDuration(IValueAnimator* this)
        long getTotalDuration(IValueAnimator* this)
        void setCurrentPlayTime(IValueAnimator* this, long playTime)
        void setCurrentFraction(IValueAnimator* this, float fraction)
        long getCurrentPlayTime(IValueAnimator* this)
        long getStartDelay(IValueAnimator* this)
        void setStartDelay(IValueAnimator* this, long startDelay)
        void setRepeatCount(IValueAnimator* this, int value)
        int getRepeatCount(IValueAnimator* this)
        void setRepeatMode(IValueAnimator* this, RepeatMode value)
        RepeatMode getRepeatMode(IValueAnimator* this)
        void addUpdateListener(IValueAnimator* this, IAnimatorUpdateListener* listener)
        void removeAllUpdateListeners(IValueAnimator* this)
        void removeUpdateListener(IValueAnimator* this, IAnimatorUpdateListener* listener)
        void setInterpolator(IValueAnimator* this, IInterpolator* value)
        IInterpolator* getInterpolator(IValueAnimator* this)
        void addListener(IValueAnimator* this, IAnimatorListener* p)
        void removeListener(IValueAnimator* this, IAnimatorListener* p)
        void start(IValueAnimator* this, ITimelineHandlersMgr* pContainer)
        void end(IValueAnimator* this)
        BOOL isRunning(IValueAnimator* this)
        BOOL isStarted(IValueAnimator* this)
        void reverse(IValueAnimator* this)
        void commitAnimationFrame(IValueAnimator* this, long frameTime)
        float getAnimatedFraction(IValueAnimator* this)
        IValueAnimator* clone(IValueAnimator* this)
        void onEvaluateValue(IValueAnimator* this, float fraction)

    ctypedef struct IValueAnimator: # (IObject)
        IValueAnimatorVtbl* lpVtbl

    ctypedef struct IAnimatorUpdateListenerVtbl:
        void onAnimationUpdate(IAnimatorUpdateListener* this, IValueAnimator* pAnimator)

    ctypedef struct IAnimatorUpdateListener:
        IAnimatorUpdateListenerVtbl* lpVtbl

    ctypedef struct IAnimatorListenerVtbl:
        void onAnimationStart(IAnimatorListener* this, IValueAnimator* pAnimator)
        void onAnimationEnd(IAnimatorListener* this, IValueAnimator* pAnimator)
        void onAnimationRepeat(IAnimatorListener* this, IValueAnimator* pAnimator)

    ctypedef struct IAnimatorListener:
        IAnimatorListenerVtbl* lpVtbl

    ctypedef struct ITimelineHandlersMgrVtbl:
        BOOL RegisterTimelineHandler(ITimelineHandlersMgr* this, ITimelineHandler* pHandler)
        BOOL UnregisterTimelineHandler(ITimelineHandlersMgr* this, ITimelineHandler* pHandler)

    ctypedef struct ITimelineHandlersMgr:
        ITimelineHandlersMgrVtbl* lpVtbl

    ctypedef struct ITimelineHandlerVtbl:
        void OnNextFrame(ITimelineHandler* this)

    ctypedef struct ITimelineHandler:
        ITimelineHandlerVtbl* lpVtbl

    # IImgFrame definition moved to render.pxd

    ctypedef struct IMaskFilterVtbl:
        void* GetPtr(IMaskFilter* this)

    ctypedef struct IMaskFilter: # (IObjRef)
        IMaskFilterVtbl* lpVtbl

    ctypedef struct IPathMeasureVtbl:
        void setPath(IPathMeasure* this, IPathS* path, BOOL forceClosed)
        float getLength(IPathMeasure* this)
        BOOL getPosTan(IPathMeasure* this, float distance, float pos[], float tan[])
        BOOL getSegment(IPathMeasure* this, float startD, float stopD, IPathS*dst, BOOL startWithMoveTo)

    ctypedef struct IPathMeasure: # (IObjRef)
        IPathMeasureVtbl* lpVtbl

    ctypedef struct IWindowVtbl:
        BOOL InitFromXml(IWindow* this, IXmlNode* xmlNode)
        HRESULT QueryInterface(IWindow* this, REFGUID id, IObjRef**ppRet)
        ISwndContainer* GetContainer(IWindow* this)
        void SetContainer(IWindow* this, ISwndContainer* pContainer)
        SWND GetSwnd(const IWindow* this)
        ILayout* GetLayout(IWindow* this)
        ILayoutParam* GetLayoutParam(const IWindow* this)
        BOOL SetLayoutParam(IWindow* this, ILayoutParam* pLayoutParam)
        BOOL IsFloat(const IWindow* this)
        BOOL IsDisplay(const IWindow* this)
        BOOL IsMsgTransparent(const IWindow* this)
        BOOL IsClipClient(const IWindow* this)
        void SetToolTipText(IWindow* this, LPCTSTR pszText)
        void SetToolTipTextA(IWindow* this, LPCSTR pszText)
        BOOL IsChecked(const IWindow* this)
        void SetCheck(IWindow* this, BOOL bCheck)
        BOOL IsDisabled(const IWindow* this, BOOL bCheckParent)
        void EnableWindow(IWindow* this, BOOL bEnable, BOOL bUpdate)
        BOOL IsVisible(const IWindow* this, BOOL bCheckParent)
        void SetVisible(IWindow* this, BOOL bVisible, BOOL bUpdate)
        ULONG_PTR GetUserData(const IWindow* this)
        ULONG_PTR SetUserData(IWindow* this, ULONG_PTR uData)
        void DoColorize(IWindow* this, COLORREF cr)
        COLORREF GetColorizeColor(const IWindow* this)
        LRESULT SSendMessage(IWindow* this, UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL* pbMsgHandled)
        void SDispatchMessage(IWindow* this, UINT uMsg, WPARAM wParam, LPARAM lParam)
        BOOL IsFocusable(const IWindow* this)
        BOOL IsFocused(const IWindow* this)
        void SetFocus(IWindow* this)
        void KillFocus(IWindow* this)
        void Invalidate(IWindow* this)
        void InvalidateRect(IWindow* this, LPCRECT lprect)
        void LockUpdate(IWindow* this)
        void UnlockUpdate(IWindow* this)
        BOOL IsUpdateLocked(const IWindow* this, BOOL bCheckParent)
        void Update(IWindow* this, BOOL bForce)
        void SetWindowRgn(IWindow* this, IRegionS* pRgn, BOOL bRedraw)
        IRegionS* GetWindowRgn(const IWindow* this)
        void SetWindowPath(IWindow* this, IPathS* pPath, BOOL bRedraw)
        IPathS* GetWindowPath(const IWindow* this)
        void Move2(IWindow* this, int x, int y, int cx, int cy)
        void Move(IWindow* this, LPCRECT prect)
        void GetWindowRect(const IWindow* this, LPRECT prect)
        void GetClientRect(const IWindow* this, LPRECT prect)
        void GetVisibleRect(const IWindow* this, LPRECT prect)
        BOOL IsContainPoint(const IWindow* this, POINT pt, BOOL bClientOnly)
        SWND SwndFromPoint(const IWindow* this, POINT* pt, BOOL bIncludeMsgTransparent)
        BOOL SetTimer(IWindow* this, char id, UINT uElapse)
        void KillTimer(IWindow* this, char id)
        SWND GetCapture(const IWindow* this)
        SWND SetCapture(IWindow* this)
        BOOL ReleaseCapture(IWindow* this)
        void SetAnimation(IWindow* this, IAnimation* animation)
        void StartAnimation(IWindow* this, IAnimation* animation)
        IAnimation* GetAnimation(const IWindow* this)
        void ClearAnimation(IWindow* this)
        void SetAlpha(IWindow* this, BYTE byAlpha)
        BYTE GetAlpha(const IWindow* this)
        void SetMatrix(IWindow* this, const IMatrix*mtx)
        void GetMatrix(const IWindow* this, IMatrix* mtx)
        int GetScale(const IWindow* this)
        void RequestRelayout(IWindow* this)
        void UpdateLayout(IWindow* this)
        void UpdateChildrenPosition(IWindow* this)
        BOOL IsLayoutDirty(const IWindow* this)
        UINT OnGetDlgCode(const IWindow* this)
        IWindow* GetIRoot(const IWindow* this)
        IWindow* GetIParent(const IWindow* this)
        IWindow* GetIWindow(const IWindow* this, int uCode)
        IWindow* GetIChild(const IWindow* this, int iChild)
        UINT GetChildrenCount(const IWindow* this)
        BOOL IsDescendant(const IWindow* this, const IWindow*pTest)
        void SetIOwner(IWindow* this, IWindow* pOwner)
        IWindow* GetIOwner(const IWindow* this)
        void BringWindowToTop(IWindow* this)
        BOOL AdjustIZOrder(IWindow* this, IWindow* pInsertAfter)
        void InsertIChild(IWindow* this, IWindow* pNewChild, IWindow* pInsertAfter)
        BOOL RemoveIChild(IWindow* this, IWindow* pChild)
        BOOL CreateChildrenFromXml(IWindow* this, LPCWSTR pszXml)
        IWindow* FindIChildByID(IWindow* this, int nId)
        IWindow* FindIChildByName(IWindow* this, LPCWSTR pszName)
        IWindow* FindIChildByNameA(IWindow* this, LPCSTR pszName)
        BOOL DestroyIChild(IWindow* this, IWindow* pChild)
        void DestroyAllChildren(IWindow* this)
        BOOL Destroy(IWindow* this)
        IWindow* GetNextLayoutIChild(const IWindow* this, const IWindow*pCurChild)
        void GetChildrenLayoutRect(const IWindow* this, RECT* prc)
        void GetDesiredSize(IWindow* this, SIZE* pSize, int nParentWid, int nParentHei)
        COLORREF GetBkgndColor(const IWindow* this)
        void SetWindowText(IWindow* this, LPCTSTR lpszText)
        void SetWindowTextA(IWindow* this, LPCSTR lpszText)
        int GetWindowText(IWindow* this, TCHAR* pBuf, int nBufLen, BOOL bRawText)
        int GetWindowTextA(IWindow* this, IStringA*pStr, BOOL bRawText)
        DWORD GetState(const IWindow* this)
        DWORD ModifyState(IWindow* this, DWORD dwStateAdd, DWORD dwStateRemove, BOOL bUpdate)
        IWindow* GetISelectedSiblingInGroup(IWindow* this)
        IWindow* GetISelectedChildInGroup(IWindow* this)
        BOOL IsSiblingsAutoGroupped(const IWindow* this)
        BOOL CreateCaret(IWindow* this, HBITMAP pBmp, int nWid, int nHeight)
        void ShowCaret(IWindow* this, BOOL bShow)
        void SetCaretPos(IWindow* this, int x, int y)
        void SetEventMute(IWindow* this, BOOL bMute)
        BOOL SubscribeEvent(IWindow* this, DWORD evtId, const IEvtSlot*pSlot)
        BOOL UnsubscribeEvent(IWindow* this, DWORD evtId, const IEvtSlot*pSlot)
        BOOL AddEvent(IWindow* this, DWORD dwEventID, LPCWSTR pszEventHandlerName)
        BOOL RemoveEvent(IWindow* this, DWORD dwEventID)
        BOOL FireEvent(IWindow* this, IEvtArgs* evt)
        BOOL FireCommand(IWindow* this)
        BOOL FireCtxMenu(IWindow* this, POINT pt)
        BOOL SwndProc(IWindow* this, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT*lResult)
        # void SetSwndProc(IWindow* this, FunSwndProc swndProc)
        HWND GetHostHwnd(IWindow* this)
        BOOL IsVideoCanvas(const IWindow* this)

    ctypedef struct IWindow: # (IObject)
        IWindowVtbl* lpVtbl

    ctypedef struct ISwndContainerVtbl:
        BOOL RegisterTimelineHandler(ISwndContainer* this, ITimelineHandler* pHandler)
        BOOL UnregisterTimelineHandler(ISwndContainer* this, ITimelineHandler* pHandler)
        BOOL RegisterDragDrop(ISwndContainer* this, SWND swnd, IDropTarget* pDropTarget)
        BOOL UnregisterDragDrop(ISwndContainer* this, SWND swnd)
        BOOL OnFireEvent(ISwndContainer* this, IEvtArgs* evt)
        IMessageLoop* GetMsgLoop(ISwndContainer* this)
        IScriptModule* GetScriptModule(ISwndContainer* this)
        # ICaret* GetCaret(ISwndContainer* this)  # Method not available in SOUI5
        HWND GetHostHwnd(ISwndContainer* this)
        BOOL IsTranslucent(const ISwndContainer* this)
        BOOL IsSendWheel2Hover(const ISwndContainer* this)
        int GetScale(const ISwndContainer* this)
        LPCWSTR GetTranslatorContext(const ISwndContainer* this)
        void GetContainerRect(const ISwndContainer* this, RECT *prc)
        void UpdateRegion(ISwndContainer* this, IRegionS* rgn)
        # IRenderTarget* OnGetRenderTarget(ISwndContainer* this, LPCRECT rc, GrtFlag gdcFlags)  # Method not available in SOUI5
        # void OnReleaseRenderTarget(ISwndContainer* this, IRenderTarget* pRT, LPCRECT rc, GrtFlag gdcFlags)  # Method not available in SOUI5
        void OnRedraw(ISwndContainer* this, LPCRECT rc, BOOL bClip)
        # void OnCavasInvalidate(ISwndContainer* this, SWND swnd)
        SWND OnGetSwndCapture(const ISwndContainer* this)
        SWND OnSetSwndCapture(ISwndContainer* this, SWND swnd)
        BOOL OnReleaseSwndCapture(ISwndContainer* this)
        SWND GetHover(const ISwndContainer* this)
        SWND GetFocus(const ISwndContainer* this)
        void OnSetSwndFocus(ISwndContainer* this, SWND swnd)
        BOOL UpdateWindow(ISwndContainer* this, BOOL bForce)
        void UpdateTooltip(ISwndContainer* this)
        void FrameToHost(const ISwndContainer* this, RECT* rc)
        IAcceleratorMgr* GetAcceleratorMgr(ISwndContainer* this)
        BOOL RegisterTrackMouseEvent(ISwndContainer* this, SWND swnd)
        BOOL UnregisterTrackMouseEvent(ISwndContainer* this, SWND swnd)
        void MarkWndTreeZorderDirty(ISwndContainer* this)
        void BuildWndTreeZorder(ISwndContainer* this)
        void EnableIME(ISwndContainer* this, BOOL bEnable)
        void OnUpdateCursor(ISwndContainer* this)

    ctypedef struct ISwndContainer: # (ITimelineHandlersMgr)
        ISwndContainerVtbl* lpVtbl

    ctypedef struct IDropTargetVtbl:
        # HRESULT QueryInterface(IDropTarget * this, REFIID riid, void **ppvObject)
        # ULONG AddRef(IDropTarget * this)
        # ULONG Release(IDropTarget * this)
        # HRESULT DragEnter(IDropTarget * this, IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
        # HRESULT DragOver(IDropTarget * this, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
        # HRESULT DragLeave(IDropTarget* this)
        # HRESULT Drop(IDropTarget * this, IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
        pass

    ctypedef struct IDropTarget:
        IDropTargetVtbl* lpVtbl

    ctypedef struct ICaretVtbl:
        BOOL Init(ICaret* this, HBITMAP hBmp, int nWid, int nHei)
        void SetPosition(ICaret* this, int x, int y)
        BOOL SetVisible(ICaret* this, BOOL bVisible, SWND owner)
        BOOL IsVisible(const ICaret* this)
        void Draw(ICaret* this, IRenderTarget* pRT)
        RECT GetRect(const ICaret* this)

    ctypedef struct ICaret: # (IObject)
        ICaretVtbl* lpVtbl

    ctypedef struct IAcceleratorMgrVtbl:
        void RegisterAccelerator(IAcceleratorMgr* this, const IAccelerator*pAcc, IAcceleratorTarget*target)
        void UnregisterAccelerator(IAcceleratorMgr* this, const IAccelerator*pAcc, IAcceleratorTarget*target)
        void UnregisterAccelerators(IAcceleratorMgr* this, IAcceleratorTarget* target)

    ctypedef struct IAcceleratorMgr:
        IAcceleratorMgrVtbl* lpVtbl

    ctypedef struct IAcceleratorVtbl:
        WORD GetModifier(const IAccelerator* this)
        WORD GetKey(const IAccelerator* this)
        DWORD GetAcc(const IAccelerator* this)

    ctypedef struct IAccelerator:
        IAcceleratorVtbl* lpVtbl

    ctypedef struct IAcceleratorTargetVtbl:
        BOOL OnAcceleratorPressed(IAcceleratorTarget* this, const IAccelerator*acc)

    ctypedef struct IAcceleratorTarget:
        IAcceleratorTargetVtbl* lpVtbl

    ctypedef struct ILayout:
        pass

    ctypedef struct ILayoutParam:
        pass

    ctypedef struct IMatrixVtbl:
        IxForm* Data(const IMatrix* this)
        void reset(IMatrix* this)
        void setIdentity(IMatrix* this)
        BOOL isIdentity(const IMatrix* this)
        void setTranslate(IMatrix* this, float dx, float dy)
        void setScale(IMatrix* this, float sx, float sy)
        void setScale2(IMatrix* this, float sx, float sy, float px, float py)
        void setRotate(IMatrix* this, float degrees)
        void setRotate2(IMatrix* this, float degrees, float px, float py)
        void setSkew(IMatrix* this, float kx, float ky)
        void setSkew2(IMatrix* this, float kx, float ky, float px, float py)

    ctypedef struct IMatrix:
        IMatrixVtbl* lpVtbl

    ctypedef struct INcPainterVtbl:
        IWindow* GetRoot(INcPainter* this)

    ctypedef struct INcPainter: # (IObject)
        INcPainterVtbl* lpVtbl
